package com.itheima.developtest;

import java.util.Random;

public class Test01 {
    public static void main(String[] args) {
        String list = "令狐冲, 风清扬,左冷禅,岳不群,苗人凤";
        String[] newList = list.split(",");
        System.out.println("本班人员名单如下:");
        for (int i = 0; i < newList.length; i++) {
            String s = newList[i];
            System.out.print(s+" ");
            if(i % 2 != 0){
                System.out.println();
            }
        }
        System.out.println();
        System.out.print("本次被选中的幸运同学是:");
        Random r = new Random();
        int index = r.nextInt(newList.length);
        System.out.println(newList[index]);
    }
}
